const path = require('path');
const webpack           = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
  entry: './src/app.jsx',  //入口
  //出口
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'app.js',
  },
  plugins: [
    // 处理html文件 
    new HtmlWebpackPlugin({
        template: './src/index.html',
    }),
],
module: {
  rules: [
    // react(jsx)语法的处理
    {
      test: /\.m?jsx$/,
      exclude: /(node_modules)/,
      use: {
        loader: 'babel-loader',
        options: {
          presets: ['env','react']
        }
      }
    },
      // css文件的处理
      {
        test: /\.css$/,
        use: [{ loader: 'style-loader/url' }, { loader: 'file-loader' }],
      },
  ]
}
};